<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>

<div style="margin:20px 0;"></div>
<div class="easyui-panel" >
    <div style="padding:10px 60px 20px 60px">
        <form id="serviceParamForm"  name="serviceParamForm" method="post" >
            <input id="service_param_uuid" type="hidden" name="service_param_uuid" value="${serviceParamEntity.service_param_uuid}"/>
            <input id="rec_id" type="hidden" name="rec_id" value="${serviceParamEntity.rec_id}"/>
            <input id="service_uuid" type="hidden" name="service_uuid" value="${serviceParamEntity.service_uuid}"/>
            <table cellpadding="5" style="width:100%">
                <tr>
                    <td>业务参数编号:</td>
                    <td><input class="easyui-textbox" <c:if test="${serviceParamEntity.service_param_uuid != '' && serviceParamEntity.service_param_uuid != null}">readonly="readonly"</c:if> type="text" name="param_no" data-options="required:true,validType:['checkServiceParamNo']" value="${serviceParamEntity.param_no }"></input></td>
                </tr>
                <tr>
                    <td>业务参数名称:</td>
                    <td><input class="easyui-textbox" type="text"  name="param_name" data-options="required:true,validType:['length[0,30]']" value="${serviceParamEntity.param_name}"></input></td>
                </tr>
                <tr>
                    <td>所属业务:</td>
                    <td>
                        <select id="serviceUUID" class="easyui-combobox" editable="false" data-options="valueField:'SERVICE_UUID',textField:'SERVICE_NAME',url:'../serviceParam/getAllService.do?service_uuid=${serviceParamEntity.service_uuid}'" style="width:200px;" name="serviceUUID">
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>业务参数状态:</td>
                    <td><code:codeSelect id="param_st" name="param_st" code_type="service_st" showSelect="true" selectId="${serviceParamEntity.param_st}"></code:codeSelect></td>
                </tr>
                <tr>
                    <td>借记卡-扣率最小值(万分之):</td>
                    <td><input class="easyui-numberspinner" name="min_rate" data-options="required:true,precision:0,min:0,max:10000" value="${serviceParamEntity.min_rate}"></input></td>
                </tr>
                <tr>
                    <td>借记卡-附加手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_attachfee" data-options="required:true,precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_attachfee}"></input></td>
                </tr>
                <tr>
                    <td>借记卡-最小手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_fee" data-options="precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_fee}"></input></td>
                </tr>
                <tr>
                    <td>借记卡-最大手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_maxfee" data-options="precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_maxfee}"></input></td>
                </tr>
                <tr>
                    <td>贷记卡-扣率最小值(万分之):</td>
                    <td><input class="easyui-numberspinner" name="min_rate2" data-options="required:true,precision:0,min:0,max:10000" value="${serviceParamEntity.min_rate2}"></input></td>
                </tr>
                <tr>
                    <td>贷记卡-附加手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_attachfee2" data-options="required:true,precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_attachfee2}"></input></td>
                </tr>
                <tr>
                    <td>贷记卡-最小手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_fee2" data-options="precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_fee2}"></input></td>
                </tr>
                <tr>
                    <td>贷记卡-最大手续费扣率最小值(元):</td>
                    <td><input class="easyui-numberspinner" name="min_maxfee2" data-options="precision:2,decimalSeparator:'.',min:0,max:9999999999.99" value="${serviceParamEntity.min_maxfee2}"></input></td>
                </tr>
            </table>

            <div style="text-align:center;padding:5px">
                <%--<a href="javascript:void(0)" class="easyui-linkbutton btn detail-remove" onclick="saveServiceParam()">保存</a>--%>
                <%--<a href="javascript:void(0)" class="easyui-linkbutton btn" onclick="back()">返回</a>--%>

                <jiepos:buttonDetailTag menuCode="${menuCode}" formId="serviceForm"></jiepos:buttonDetailTag>
            </div>
        </form>
    </div>
</div>
<script>

    function saveServiceParam(urls){
        if($("#param_st").val() == "" ||$("#param_st").val() == null){
            $.jpmessage.info('请选择业务参数状态');
            return;
        }
        //把combobox值赋给隐藏域service_uuid
        var service_uuid = $('#serviceUUID').combobox('getValue');
        if(service_uuid == null || service_uuid == ""){
            $.jpmessage.info('请选择所属业务');
            return;
        }else{
            $("#service_uuid").val(service_uuid);
        }
        //检验
        if($("#serviceParamForm").form("validate")){
            var options ={
                url:'<c:url value="/serviceParam/checkServiceParam.do"/>',
                type:'post',
                success:function(data){
                    var result=data;
                    if("success"==result){
                        //表单提交的方法、比如ajax提交
                        $("#serviceParamForm").attr("action",urls);
                        document.getElementById("serviceParamForm").submit();
                    }else{
                        $.jpmessage.info('业务参数编号不能重复!');
                    }
                }
            };
            $("#serviceParamForm").ajaxSubmit(options);
        }
    }

    $(document).ready(function() {
        $.extend($.fn.textbox.defaults.rules, {
            checkServiceParamNo: {
                validator: function(value){
                    var reg = new RegExp("^[a-zA-Z0-9_]{0,20}$");
                    return reg.test(value);
                },
                message: '业务参数编号需为0-20位数字或字母'
            }
        });
    });

</script>